#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <pthread.h>
#include <semaphore.h>
#include "queue.h"
#include "pool.h"


void *fun1(void *arg)
{
	int *p = (int *)arg;
	printf("data = %d\n",*p);
}
void *fun2(void *arg)
{
	char *s = (char *)arg;
	printf("%s\n",s);
}


int main()
{
	pthread_t th = 0;
	int ret = 0;
	struct threadpool *pool = NULL;

	pool = create_threadpool(5,5);

	int *p = (int *)malloc(sizeof(int));
	*p = 23;//此处采用动态分配空间方式实现，线程池中释放空间。

	threadpool_add_task(pool,fun1,p);
	char *q = malloc(sizeof(char)*100);
	strcpy(q,"dajiahao");
	threadpool_add_task(pool,fun2,q);

	while(1)
	{

	}

	threadpool_destroy(pool);
	
	return 0;

}



